package com.ycsj.goldmedalnewconcept.teacher.adapter;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.makeramen.roundedimageview.RoundedImageView;
import com.ycsj.goldmedalnewconcept.R;
import com.ycsj.goldmedalnewconcept.teacher.bean.ByqzInfo;

import java.util.List;

/**
 * 被邀请者的列表适配器
 * Created by Administrator on 2019/4/2 0002.
 */

public class RvByqzAdapter extends BaseQuickAdapter<ByqzInfo, BaseViewHolder> {

    private Context context;

    public RvByqzAdapter(Context context, int layoutResId, @Nullable List<ByqzInfo> data) {
        super(layoutResId, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, ByqzInfo item) {
        //头像
        RoundedImageView lvHead = helper.getView(R.id.lv_head);

        //姓名
        TextView tvName = helper.getView(R.id.tv_name);

        //电话
        TextView tvTel = helper.getView(R.id.tv_tel);

        //复制
        TextView tvFz = helper.getView(R.id.tv_fz);
        tvFz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //复制的点击事件
            }
        });

        //邀请者姓名
        TextView tvYqzName = helper.getView(R.id.tv_yqz_name);

        //邀请时间
        TextView tvYqzTime = helper.getView(R.id.tv_yqz_time);

    }


    /**
     * 复制内容到剪切板
     *
     * @param copyStr
     * @return
     */
    private boolean copy(Context context, String copyStr) {
        try {
            //获取剪贴板管理器
            ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            // 创建普通字符型ClipData
            ClipData mClipData = ClipData.newPlainText("Label", copyStr);
            // 将ClipData内容放到系统剪贴板里。
            cm.setPrimaryClip(mClipData);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
